From: Matthias Clasen Date: Fri, 18 Oct 2019 12:46:52 +0000 (-0500) Subject: Add another symbolic pixbuf helper X-Git-Tag: archive/raspbian/4.4.1+ds1-2+rpi1~1^2~321^2^2~696^2~5 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=3c219bf968fe698269e54896715066acba23db16;p=gtk4.git Add another symbolic pixbuf helper --- diff --git a/gtk/gdkpixbufutilsprivate.h b/gtk/gdkpixbufutilsprivate.h index 592bc9ea59..bd6125ea52 100644 --- a/gtk/gdkpixbufutilsprivate.h +++ b/gtk/gdkpixbufutilsprivate.h @@ -63,6 +63,11 @@ GdkPixbuf *gtk_make_symbolic_pixbuf_from_file (GFile *file, int height, double scale, GError **error); +GdkPixbuf *gtk_make_symbolic_pixbuf_from_path (const char *path, + int width, + int height, + double scale, + GError **error); GdkPixbuf *gtk_make_symbolic_pixbuf_from_resource (const char *path, int width, int height, diff --git a/gtk/tools/gdkpixbufutils.c b/gtk/tools/gdkpixbufutils.c index a572f48a82..ae2684adb2 100644 --- a/gtk/tools/gdkpixbufutils.c +++ b/gtk/tools/gdkpixbufutils.c @@ -425,6 +425,27 @@ gtk_make_symbolic_pixbuf_from_resource (const char *path, return pixbuf; } +GdkPixbuf * +gtk_make_symbolic_pixbuf_from_path (const char *path, + int width, + int height, + double scale, + GError **error) +{ + char *data; + gsize size; + GdkPixbuf *pixbuf; + + if (!g_file_get_contents (path, &data, &size, error)) + return NULL; + + pixbuf = gtk_make_symbolic_pixbuf_from_data (data, size, width, height, scale, error); + + g_free (data); + + return pixbuf; +} + GdkPixbuf * gtk_make_symbolic_pixbuf_from_file (GFile *file, int width,